from typing import List
import math

class Solution:
    def getAverages(self, nums: List[int], k: int) -> List[int]:
        n=len(nums)
        ans=[-1]*n
        k=2*k+1
        cnt=0
        for i in range(n):
            # 1. 进入窗口
            cnt+=nums[i]
            # 2.长度不足k，跳过
            if i<k-1:
                continue
            # 3.更新答案
            avg=math.floor(cnt/k)
            ans[i-k//2]=avg
            # 4.移除左窗口
            cnt-=nums[i-k+1]
        return ans